﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.RenderTargetBlendState
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Values for the blend state.</para>
  /// </summary>
  /// <summary>
  ///   <para>Creates a new blend state with the given values.</para>
  /// </summary>
  /// <param name="writeMask">Specifies which color components will get written into the target framebuffer.</param>
  /// <param name="sourceColorBlendMode">Blend factor used for the color (RGB) channel of the source.</param>
  /// <param name="destinationColorBlendMode">Blend factor used for the color (RGB) channel of the destination.</param>
  /// <param name="sourceAlphaBlendMode">Blend factor used for the alpha (A) channel of the source.</param>
  /// <param name="destinationAlphaBlendMode">Blend factor used for the alpha (A) channel of the destination.</param>
  /// <param name="colorBlendOperation">Operation used for blending the color (RGB) channel.</param>
  /// <param name="alphaBlendOperation">Operation used for blending the alpha (A) channel.</param>
  public struct RenderTargetBlendState(
    ColorWriteMask writeMask = ColorWriteMask.All,
    BlendMode sourceColorBlendMode = BlendMode.One,
    BlendMode destinationColorBlendMode = BlendMode.Zero,
    BlendMode sourceAlphaBlendMode = BlendMode.One,
    BlendMode destinationAlphaBlendMode = BlendMode.Zero,
    BlendOp colorBlendOperation = BlendOp.Add,
    BlendOp alphaBlendOperation = BlendOp.Add) : IEquatable<RenderTargetBlendState>
  {
    private byte m_WriteMask = (byte) writeMask;
    private byte m_SourceColorBlendMode = (byte) sourceColorBlendMode;
    private byte m_DestinationColorBlendMode = (byte) destinationColorBlendMode;
    private byte m_SourceAlphaBlendMode = (byte) sourceAlphaBlendMode;
    private byte m_DestinationAlphaBlendMode = (byte) destinationAlphaBlendMode;
    private byte m_ColorBlendOperation = (byte) colorBlendOperation;
    private byte m_AlphaBlendOperation = (byte) alphaBlendOperation;
    private byte m_Padding = 0;

    /// <summary>
    ///   <para>Default values for the blend state.</para>
    /// </summary>
    public static RenderTargetBlendState defaultValue => new RenderTargetBlendState();

    /// <summary>
    ///   <para>Specifies which color components will get written into the target framebuffer.</para>
    /// </summary>
    public ColorWriteMask writeMask
    {
      get => (ColorWriteMask) this.m_WriteMask;
      set => this.m_WriteMask = (byte) value;
    }

    /// <summary>
    ///   <para>Blend factor used for the color (RGB) channel of the source.</para>
    /// </summary>
    public BlendMode sourceColorBlendMode
    {
      get => (BlendMode) this.m_SourceColorBlendMode;
      set => this.m_SourceColorBlendMode = (byte) value;
    }

    /// <summary>
    ///   <para>Blend factor used for the color (RGB) channel of the destination.</para>
    /// </summary>
    public BlendMode destinationColorBlendMode
    {
      get => (BlendMode) this.m_DestinationColorBlendMode;
      set => this.m_DestinationColorBlendMode = (byte) value;
    }

    /// <summary>
    ///   <para>Blend factor used for the alpha (A) channel of the source.</para>
    /// </summary>
    public BlendMode sourceAlphaBlendMode
    {
      get => (BlendMode) this.m_SourceAlphaBlendMode;
      set => this.m_SourceAlphaBlendMode = (byte) value;
    }

    /// <summary>
    ///   <para>Blend factor used for the alpha (A) channel of the destination.</para>
    /// </summary>
    public BlendMode destinationAlphaBlendMode
    {
      get => (BlendMode) this.m_DestinationAlphaBlendMode;
      set => this.m_DestinationAlphaBlendMode = (byte) value;
    }

    /// <summary>
    ///   <para>Operation used for blending the color (RGB) channel.</para>
    /// </summary>
    public BlendOp colorBlendOperation
    {
      get => (BlendOp) this.m_ColorBlendOperation;
      set => this.m_ColorBlendOperation = (byte) value;
    }

    /// <summary>
    ///   <para>Operation used for blending the alpha (A) channel.</para>
    /// </summary>
    public BlendOp alphaBlendOperation
    {
      get => (BlendOp) this.m_AlphaBlendOperation;
      set => this.m_AlphaBlendOperation = (byte) value;
    }

    public bool Equals(RenderTargetBlendState other)
    {
      return (int) this.m_WriteMask == (int) other.m_WriteMask && (int) this.m_SourceColorBlendMode == (int) other.m_SourceColorBlendMode && (int) this.m_DestinationColorBlendMode == (int) other.m_DestinationColorBlendMode && (int) this.m_SourceAlphaBlendMode == (int) other.m_SourceAlphaBlendMode && (int) this.m_DestinationAlphaBlendMode == (int) other.m_DestinationAlphaBlendMode && (int) this.m_ColorBlendOperation == (int) other.m_ColorBlendOperation && (int) this.m_AlphaBlendOperation == (int) other.m_AlphaBlendOperation;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is RenderTargetBlendState other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return (((((this.m_WriteMask.GetHashCode() * 397 ^ this.m_SourceColorBlendMode.GetHashCode()) * 397 ^ this.m_DestinationColorBlendMode.GetHashCode()) * 397 ^ this.m_SourceAlphaBlendMode.GetHashCode()) * 397 ^ this.m_DestinationAlphaBlendMode.GetHashCode()) * 397 ^ this.m_ColorBlendOperation.GetHashCode()) * 397 ^ this.m_AlphaBlendOperation.GetHashCode();
    }

    public static bool operator ==(RenderTargetBlendState left, RenderTargetBlendState right)
    {
      return left.Equals(right);
    }

    public static bool operator !=(RenderTargetBlendState left, RenderTargetBlendState right)
    {
      return !left.Equals(right);
    }
  }
}
